package com.zhiyou.aifeng.viewmodel

import com.lzg.extend.BaseResponse
import com.lzg.extend.jackson.JacksonConvert
import com.lzg.okrx.adapter.FlowableBody
import com.lzy.okgo.OkGo
import com.zhiyou.aifeng.common_ui.model.BaseUrl
import com.zhiyou.aifeng.common_ui.model.CommonModel
import com.zhiyou.aifeng.common_ui.utils.applyFlowableSchedulers
import com.zhiyou.aifeng.common_ui.viewmodel.BaseViewModel

class MatterViewModel : BaseViewModel() {

    fun getMatterList(page: Int, uid: String) =
        OkGo.post<BaseResponse<CommonModel>>(BaseUrl.workList)
            .params(
                getParams(
                    "uid" to uid,
                    "page" to page,
                    "pageSize" to 10
                )
            )
            .converter(object : JacksonConvert<BaseResponse<CommonModel>>() {})
            .adapt(FlowableBody())
            .compose(applyFlowableSchedulers())
            .map { it.data.results }

}